package com.educate.pojo.response;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author xiongyu
 * @date 2021/8/1 23:27
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class ErrorResult {

    /**
     * 异常状态码
     */
    private Integer status;
    /**
     *  用户可见异常描述信息
     */
    private String message;
    /**
     * 异常的名称
     */
    private String exceptionName;


    public static ErrorResult fail(ResultCode resultCode, Throwable e) {

        return new ErrorResult(resultCode.getCode(),resultCode.getMsg(), e.getClass().getName());
    }

}
